﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;

/// <summary>
/// HtmlHelper 的摘要说明
/// </summary>
public class HtmlHelper
{
    public HtmlHelper()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
    }
    public static string ReadModel(string FileName)
    {
        string re = "";
        string path = HttpContext.Current.Server.MapPath("/UI/");
        StreamReader sr = new StreamReader(path + FileName, Encoding.GetEncoding("UTF-8"));
        try
        {
            re = sr.ReadToEnd();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            sr.Close();
        }
        return re;
    }
    public static void writeHtml(string filmname, string html)

    {
        System.Text.Encoding code = System.Text.Encoding.GetEncoding("UTF-8");
        string htmlfilename = filmname;
        string str = html;
        StreamWriter sw = null;
        // 写文件
        try
        {
            sw = new StreamWriter(htmlfilename, false, code);
            sw.Write(str);
            sw.Flush();
        }
        catch (Exception ex)
        {
            HttpContext.Current.Response.Write(ex.Message);
            HttpContext.Current.Response.End();
        }
        finally
        {
            sw.Close();
        }
    }
}